<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JavaScript函数</title>
</head>

<body>
    <script>
        function hello() {
            console.log('Hello world');
        }
        hello();

        function hello_return() {
            return 'Hello world - 返回值'
        }
        let a = hello_return();
        console.log(a);
        console.log(hello_return());

        function hello_with_para(name) {
            console.log('Hello ' + name);
        }
        hello_with_para('梨花');

        // 作用域
        let global_var = 'global_var'
        function local_var_function() {
            let local_var = 'local_var';
            console.log('打印全局变量 ' + global_var);
            console.log('打印局部变量 ' + local_var);
        }
        local_var_function();
    </script>
</body>
</html>